#include "Lock.h"

Lock::Lock() {
  pthread_mutex_init(&mMutex, NULL);
}

void Lock::acquire() {
  pthread_mutex_lock(&mMutex);
}

bool Lock::tryAcquire() {
  int i = pthread_mutex_trylock(&mMutex);
  return i == 0;
}

void Lock::release() {
  pthread_mutex_unlock(&mMutex);
}
